package com.movie.modules.api.controller;

import com.movie.common.utils.R;
import com.movie.common.utils.SmsUtil;
import com.movie.modules.api.form.LoginForm;
import com.movie.modules.api.service.ApiLoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author JF-PJJ
 */
@RestController
@Api(tags = "前台登录模块")
@RequestMapping("/api")
public class ApiLoginController {

    @Autowired
    private ApiLoginService loginService;

    @GetMapping("/send/{uuid}")
    @ApiOperation("发送验证码")
    public R sendMsg(String mobile,@PathVariable("uuid") String uuid){
        return loginService.sendMsg(mobile, uuid);
    }

    @PostMapping("/login")
    @ApiOperation("登录")
    public R login(@RequestBody LoginForm login){
        return loginService.login(login);
    }

    @PostMapping("/logout")
    @ApiOperation("退出登录")
    public R logout(){
        return R.ok();
    }
}
